package com.lvmama.pangolin.hotel.service.impl;

import java.util.List;
import java.util.Map;

import com.lvmama.pangolin.core.AbstractBaseCommodityService;
import com.lvmama.pangolin.mybatis.mapper.hotel.HotelCommodityDetailMapper;

import com.github.pagehelper.PageHelper;
import com.lvmama.pangolin.core.AbstractService;

import com.lvmama.pangolin.entity.CommodityConditionVO;
import com.lvmama.pangolin.entity.InputCommodityVO;
import com.lvmama.pangolin.entity.hotel.HotelCdetail;
import com.lvmama.pangolin.entity.hotel.HotelCommodityDetail;
import com.lvmama.pangolin.entity.hotel.HotelCommodityDetailError;
import com.lvmama.pangolin.hotel.service.HotelCommodityDetailService;
import com.lvmama.pangolin.mybatis.mapper.hotel.HotelCommodityDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;


/**
 * Created by zhoutianqi on 2017/08/15.
 */
@Service
@Transactional
public class HotelCommodityDetailServiceImpl extends AbstractBaseCommodityService<HotelCommodityDetail> implements HotelCommodityDetailService {
    @Autowired
    private HotelCommodityDetailMapper hotelCommodityDetailMapper;

    @Override
    public int saveCdetail(HotelCdetail t) {
        // TODO Auto-generated method stub
        return hotelCommodityDetailMapper.saveCdetail(t);
    }

    @Override
    public int updateByCdetail(HotelCdetail t) {
        // TODO Auto-generated method stub
        return hotelCommodityDetailMapper.updateByCdetail(t);
    }

    @Override
    public int deleteByProdMap(Map<String, String> param) {
        return hotelCommodityDetailMapper.deleteByProdMap(param);
    }

    @Override
    public void setIsLinkd(String companyCode, String productId, String commodityId) {
        hotelCommodityDetailMapper.setIsLinkd(companyCode, productId, commodityId);

    }

    @Override
    public void deleteLinkd(String companyCode, String productId, String commodityId) {
        hotelCommodityDetailMapper.deleteLinkd(companyCode, productId, commodityId);

    }

    @Override
    public List<HotelCommodityDetail> findByCommVO(CommodityConditionVO co) {
        PageHelper.startPage(co.getPage(), co.getPageSize());
        return hotelCommodityDetailMapper.findByCommVO(co);
    }

    @Override
    public List<HotelCommodityDetail> findByProdCommName(String productId, String commodityName, String companyCode) {
        // TODO Auto-generated method stub
        return hotelCommodityDetailMapper.findByProdCommName(productId, commodityName, companyCode);
    }

    @Override
    public HotelCommodityDetail findByProdCommId(String productId, String commodityId, String companyCode) {
        // TODO Auto-generated method stub
        return hotelCommodityDetailMapper.findByProdCommId(productId, commodityId, companyCode);
    }

    @Override
    public List<HotelCommodityDetail> findByInputCommodityVO(InputCommodityVO co) {
        PageHelper.startPage(co.getPage(), co.getPageSize());
        return hotelCommodityDetailMapper.findByInputCommodityVO(co);
    }

    @Override
    public int updateByProdCommId(HotelCommodityDetailError hotel) {
        return hotelCommodityDetailMapper.updateByProdCommId(hotel);
    }

    @Override
    public int updateByObject(HotelCommodityDetailError hotel) {
        return hotelCommodityDetailMapper.updateByObject(hotel);
    }

    @Override
    public int insert(HotelCommodityDetailError hotel) {
        return hotelCommodityDetailMapper.insert(hotel);
    }

}
